package com.avengers.core.bean.enums;

/**
 * 币种
 *
 * @author yu.wang
 * @since 2019/3/13 10:20 AM
 **/
public enum Currency {
    // 美元
    USD("USD", "美元", "$"),
    // 人民币
    CNY("CNY", "人民币", "￥");

    public final String value;
    public final String comment;
    public final String sign;

    Currency(String value, String comment, String sign) {
        this.value = value;
        this.comment = comment;
        this.sign = sign;
    }

    @Override
    public String toString() {
        return this.value;
    }

    public static Currency of(String currency) {
        for (Currency value : values()) {
            if (value.value.equalsIgnoreCase(currency)) {
                return value;
            }
        }
        return Currency.CNY;
    }
}
